﻿using System;

using SBPweb.Common.Session;
using SBPweb.Common.PatternHelpers;

using SBPweb.Twitter.Host.Connectivity;

namespace SBPweb.Twitter.Host.Session
{

    public class SessionManager
    {

        private static LockHelper lck = new LockHelper("SessionManager");

        #region Property accessors

        private const string KEY_WebClient = "_WebClient";
        public static Client WebClient
        {
            get
            {
                using (lck.GetLock())
                {
                    Client ret = SessionHandler.Get<Client>(KEY_WebClient);
                    if (ret == null)
                    {
                        SessionHandler.Put<Client>(KEY_WebClient, ret = new Client());
                    }
                    return ret;
                }
            }
        }

        #endregion

    }

}